<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
    <title>微信公众号添加</title>
    <meta name="decorator" content="default"/>
</head>
<body>
    <div class="main-content">
        <tags:breadcrumb menuId="6f386f0600994a4eafe82069e9f75e42" />
        <div class="page-content">
            <form:form id="inputForm" modelAttribute="weixinAccount" action="" method="post" class="form-horizontal">
                <form:hidden path="id"/>
                <div class="form-group">
                    <label class="col-sm-4 no-padding-right control-label">公众号名称:</label>
                    <div class="col-sm-8">
                        <form:input path="accountName" htmlEscape="false" maxlength="20" cssClass="required col-sm-6" placeholder="请输入公众号名称"/>
                    </div>
                </div><hr/>
                <div class="form-group">
                    <label class="col-sm-4 no-padding-right control-label">公众帐号TOKEN:</label>
                    <div class="col-sm-8">
                        <form:input path="accountToken" htmlEscape="false" maxlength="50" class="required col-sm-6" placeholder="必须是英文数字,长度为3-32个字符"/>
                    </div>
                </div><hr>
                <div class="form-group">
                    <label class="col-sm-4 no-padding-right control-label">公众号账号:</label>
                    <div class="col-sm-8">
                        <form:input path="accountNumber" htmlEscape="false" maxlength="50" class="required col-sm-6" placeholder="请输入公众号登录账号"/>
                    </div>
                </div><hr>
                <div class="form-group">
                    <label class="col-sm-4 no-padding-right control-label">公众号类型:</label>
                    <div class="col-sm-8">
                        <form:select path="accountType" class="required col-sm-6">
                            <form:option value="">----请选择----</form:option>
                            <form:options items="${fns:getDictList('Weixin_Type')}" itemLabel="label" itemValue="value"></form:options>
                        </form:select>
                    </div>
                </div><hr>
                <div class="form-group">
                    <label class="col-sm-4 no-padding-right control-label">Email:</label>
                    <div class="col-sm-8">
                        <form:input path="accountEmail" htmlEscape="false" class="required email col-sm-6" placeholder="请输入邮箱"/>
                    </div>
                </div><hr>
                <div class="form-group">
                    <label class="col-sm-4 no-padding-right control-label">公众号描述:</label>
                    <div class="col-sm-8">
                        <form:textarea path="accountDesc" cssClass="col-sm-6"></form:textarea>
                    </div>
                </div><hr>
                <div class="form-group">
                    <label class="col-sm-4 no-padding-right control-label">ACCESS_TOKEN:</label>
                    <div class="col-sm-8">
                        <form:input path="accountAccessToken" htmlEscape="false" class="required col-sm-6" placeholder="请输入token,微信公众号中的EncodingAESKey"/>
                    </div>
                </div><hr>
                <div class="form-group">
                    <label class="col-sm-4 no-padding-right control-label">公众帐号APPID:</label>
                    <div class="col-sm-8">
                        <form:input path="accountAppId" htmlEscape="false" class="required col-sm-6" placeholder="请输入公众帐号APPID"/>
                    </div>
                </div><hr>
                <div class="form-group">
                    <label class="col-sm-4 no-padding-right control-label">公众帐号APPSECRET:</label>
                    <div class="col-sm-8">
                        <form:input path="accountAppSecret" htmlEscape="false" class="required col-sm-6" placeholder="请输入公众帐号APPSECRET"/>
                    </div>
                </div><hr>
                <div class="form-group">
                    <label class="col-sm-4 no-padding-right control-label">公众号原始ID:</label>
                    <div class="col-sm-8">
                        <form:input path="weixinAccountId" htmlEscape="false" class="required col-sm-6" placeholder="请输入公众帐号原始ID"/>
                    </div>
                </div>
                <div class="form-actions">
                    <div class="col-md-offset-4">
                        <shiro:hasPermission name="sys:office:edit"><input id="btnSubmit" class="btn btn-primary" type="button" value="保 存"/>&nbsp;</shiro:hasPermission>
                        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
                    </div>
                </div>
            </form:form>
        </div>
    </div>
<script type="text/javascript">
    $(document).ready(function(){
        $("#btnSubmit").click(function(){
            if($("#inputForm").valid()){
                var url = "${ctx}/weixinAccountController/save";
                $.post(url,$("#inputForm").serialize(),function(data){
                    if(data.success){
                        showNote("success",function(){
                            window.location.href = "${ctx}/weixinAccountController/list";
                        },data.msg,"center");
                    }else{
                        showNote("error",function(){return false;},data.msg,"center");
                    }
                });
            }else{
                showNote("error",function(){return false;},"输入有误，请正确输入数据","center");
            }
        });
    });
</script>
</body>
</html>
